﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Constants
/// </summary>
public class Constants
{
    private string DBType;
    private static Constants constInstance;

	private Constants(string dbtype)
	{
        DBType = dbtype;
	}

    public static Constants GetConstInstance(string dbType)
    {
        if (constInstance == null)
            constInstance = new Constants(dbType);

        return constInstance;
    }

    #region MS SQL Server
    public string ConnectionStringName
    {
        get
        {
            if (DBType == "MySQL")
                return "MySQLEBookConn";
            else
                return "EBookConn";
        }
    }

    public string SaveEBookSPName{
        get
        {
            if (DBType == "MySQL")
                return "sp_SaveBookDetail";
            else
                return "sp_SaveBookDetail";
        }
    }


    public string GetCategorySPName{
        get
        {
            if (DBType == "MySQL")
                return "SELECT * FROM tblCategory";
            else
                return "sp_GetAllCategories";
        }
    }
    public string GetPublisherSPName{
        get
        {
            if (DBType == "MySQL")
                return "SELECT * FROM tblPublisher";
            else
                return "sp_GetAllPublishers";
        }
    }
    public string GetAllBookSPName{
        get
        {
            if (DBType == "MySQL")
                return "SELECT Id,Title,SubTitle,Summary,Edition,Author,Publisher,PublishedYear,CategoryId,Link,ThumbnailId,CreatedDate,CreatedBy FROM tblBookDetails";
            else
                return "sp_GetAllBooks";
        }
    }
    public string GetThumbnailSPName{
        get
        {
            if (DBType == "MySQL")
                return "sp_GetThumbnailData";
            else
                return "sp_GetThumbnailData";
        }
    }
    public string GetAllAuthorSPName{
        get
        {
            if (DBType == "MySQL")
                return "SELECT DISTINCT Author,0 Id FROM tblBookDetails";
            else
                return "sp_GetAllAuthors";
        }
    }
    #endregion


    #region MySQL
    //public static string MySQLConnectionStringName = "MySQLEBookConn";
    //public static string MySQLSaveEBookSPName = "sp_SaveBookDetail";
    //public static string MySQLGetCategorySPName = "SELECT * FROM tblCategory";
    //public static string MySQLGetPublisherSPName = "SELECT * FROM tblPublisher";
    //public static string MySQLGetAllBookSPName = "SELECT Id,Title,SubTitle,Summary,Edition,Author,Publisher,PublishedYear,CategoryId,Link,ThumbnailId,CreatedDate,CreatedBy FROM tblBookDetails";
    //public static string MySQLGetThumbnailSPName = "sp_GetThumbnailData";
    //public static string MySQLGetAllAuthorSPName = "SELECT DISTINCT Author,0 Id FROM tblBookDetails";
    
    #endregion
}